<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/11/27
 * Time: 18:22
 */

require("Include/conn.php");
global $link;
if(isset($_COOKIE['user_id'])&&is_numeric($_COOKIE['user_id'])){
    $user_id = $_COOKIE['user_id'];
    $pic_id = $_POST["picid"];
    $comment = $_POST["comment"];

    $sql = "INSERT INTO `pw_cmnt` (`cmnt_picid`,`cmnt_userid`,`cmnt_ctin`,`cmnt_stat`) VALUES ($pic_id,$user_id,'$comment',1);";
    $result = mysqli_query($link,$sql);
    if($result){
        echo "<script>history.go(-1);</script>";
    }
    else{
        echo "评论发布失败！";
        echo "<script>history.go(-1);location.reload();</script>";
    }
    //header("location:http://localhost/mark/index.php");
}
else{
    header('location: http://localhost/mark/login.php');
}


?>